feat(instagram): add Instagram integration#5568
Conversation
Resolve UserFiles to Meta-fetchable presigned HTTPS URLs (600s TTL) via internal publish routes, and fix OAuth scope storage plus connect-draft wiring so Instagram Login publishing is testable end-to-end. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview TikTok changes in the same PR: video draft upload now streams from storage with bounded chunking/retries instead of buffering the whole file; Direct Post returns 400 until per-post approval exists; webhook ingress fans out in fixed-size keyset pages with chained durable jobs. OAuth connect-draft creation is centralized in Reviewed by Cursor Bugbot for commit 952399a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds Instagram integration support across OAuth, blocks, tools, and publishing routes. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(instagram): drop hidden Instagram fr..." | Re-trigger Greptile |
…s, extend poll window and insights periods, use canonical user_id in OAuth callback
…r_id Co-authored-by: Cursor <cursoragent@cursor.com>
…ts, request message timestamps explicitly Co-authored-by: Cursor <cursoragent@cursor.com>
…trim() calls are safe Co-authored-by: Cursor <cursoragent@cursor.com>
Match the official Instagram look by filling the tile with the orange–pink–purple radial gradient so the white camera glyph sits on a full-bleed brand background. Co-authored-by: Cursor <cursoragent@cursor.com>
Default Reel share-to-feed to Yes, drop unused media fields params, share publish transform helpers, and warn when cloud storage is missing for Meta-fetchable uploads. Co-authored-by: Cursor <cursoragent@cursor.com>
Treat loading/error as blocked for requiresCloudStorage uploads, show the warning once the check finishes, and disable selecting local workspace files Meta cannot fetch. Co-authored-by: Cursor <cursoragent@cursor.com>
Meta only allows refreshing still-valid Instagram tokens, so refresh within 14 days of expiry (after the 24h age gate) instead of waiting until after accessTokenExpiresAt. Co-authored-by: Cursor <cursoragent@cursor.com>
The staging merge dropped the opening /** on ProviderAuthConfig.clientIdParamName, which broke TypeScript parse in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
Wire /api/files/storage-status through a shared route contract so the strict API validation audit stays at zero non-Zod routes after the new Instagram cloud-storage check. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop public-URL paste hints from advanced fields and the cloud-storage banner so the UI mirrors Gmail attachments. Co-authored-by: Cursor <cursoragent@cursor.com>
…integration # Conflicts: # apps/sim/lib/uploads/utils/file-utils.server.ts
Instagram is hideFromToolbar so it is excluded from integrations.json; the pinned slug map must not expect it until the block is visible again. Co-authored-by: Cursor <cursoragent@cursor.com>
|
bugbot run |
| workflow: workflowRecord, | ||
| })) | ||
| const nextCursor = rows.at(-1)?.webhookId ?? null | ||
| const hasMore = rows.length === TIKTOK_WEBHOOK_TARGET_PAGE_SIZE |
There was a problem hiding this comment.
TikTok page hasMore false positive
Low Severity
Keyset pagination uses limit(PAGE_SIZE) and sets hasMore when rows.length === PAGE_SIZE instead of fetching PAGE_SIZE + 1 to peek. When a delivery has exactly 100 matching rows, ingress enqueues a continuation page that returns no targets, adding avoidable job churn under the shared concurrency limit.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 30de5b1. Configure here.
Avoid orphan pending credential drafts when INSTAGRAM_CLIENT_ID is missing, matching the Shopify authorize ordering. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 952399a. Configure here.
| pendingCredentialDraft.workspaceId, | ||
| ], | ||
| set: { displayName, expiresAt, createdAt: now }, | ||
| }) |
There was a problem hiding this comment.
Stale reconnect draft survives upsert
Medium Severity
createConnectDraft upserts on (userId, providerId, workspaceId) but does not reset credentialId, unlike the credential draft API which sets credentialId to null for new connects. Instagram authorize uses this helper whenever workspaceId is present, so an unexpired reconnect draft can make a new Copilot Instagram connect run as a reconnect and attach the wrong credential.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 952399a. Configure here.
| return { | ||
| chunkSize: DEFAULT_CHUNK_SIZE, | ||
| totalChunkCount: Math.floor(totalBytes / DEFAULT_CHUNK_SIZE), | ||
| } |
There was a problem hiding this comment.
Single-chunk TikTok size mismatch
Medium Severity
computeTikTokChunkPlan only sets chunkSize equal to totalBytes when the file is at most 10MB. For sizes in (10MB, 20MB), Math.floor yields totalChunkCount: 1 while chunkSize stays 10MB, so init metadata disagrees with the single uploaded range. TikTok expects chunk_size to match video_size for one-chunk uploads, so common draft uploads in that size band can fail at init or transfer.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 952399a. Configure here.


Summary
Adds Business Login OAuth, 23 tools, block, and publish routes for Instagram
Type of Change
Testing
Tested manually
Checklist